<section class="section {page->class}">
	<h2 class="hide">{page->title}</h2>
	<script>
		$(function() {		
			$("#member_modify").validate({
				rules: {
					 mem_name : "required"
					,mem_email : {required:true, email:true}
				},
				submitHandler : function(form) {
					// ajax로 등록후 list 페이지 새로 고침
					$.ajax({
						 url : form.action
						,data : $(form).serialize()
						,success:function(data){
							if(data.code == mesg.success) {
								sagapo.article_refresh(data.return_url);
								
								// 리스트 페이지에서 변경된 값 바꿔주기
								$(".email_{result->m_id}").text($("#mem_email").val());
								$(".name_{result->m_id}").text($("#mem_name").val())
							} else {
								alert(data.msg);
							}
							
							return false;
						}
					});
				}
			});
			
			$("input:radio[name='mem_sendemail'][value='{result->m_sendemail}']").attr("checked","checked");
			$("input:radio[name='mem_auth'][value='{result->m_auth}']").attr("checked","checked");
			
			
			$(".member_add a.button.password").click(function() {
				loadDialogForm($(this).attr("href"), null, '비밀번호 수정', 400, 260, null, 'password');
				return false;
			});
			
			// 반드시 셋타임 아웃을 해줘야됨.
			setTimeout(function(){
				$('textarea.wysiwyg').elrte(opts);
				
				// 포커스가 wysiwyg 쪽으로 이동하기 때문에 젤 처럼 element로 포커스 다시 이동시키기
				$("#mem_name").focus();
			},300);
		});
	</script>
	<form name="member_modify" id="member_modify" action="{CFG->PATH->WWWADMIN}/member/doModify" method="post">
		<table class="table">
			<caption>
				{page->title}
			</caption>
			<colgroup>
				<col class="add" />
				<col />
			</colgroup>
			<tbody>
				<tr>
					<th scope="row" class="txt_right br">아이디</th>
					<td>
						{result->m_id}
						<input type="hidden" name="mem_seq" value="{result->m_seq}" />
					</td>
				</tr>
				<tr>
					<th scope="row" class="txt_right br">비밀번호 변경</th>
					<td>
						<a href="{CFG->PATH->WWWADMIN}/member/passwordChange/{result->m_seq}" class="button password">비밀번호 변경</a>
					</td>
				</tr>
				<tr>
					<th scope="row" class="txt_right br"><label for="mem_name">이름</label></th>
					<td>
						<input type="text" name="mem_name" id="mem_name" placeholder="이름" value="{result->m_name}" />
					</td>
				</tr>
				<tr>
					<th scope="row" class="txt_right br"><label for="mem_email">이메일</label></th>
					<td>
						<input type="email" name="mem_email" id="mem_email" placeholder="email" class="width_60" value="{result->m_email}" />
					</td>
				</tr>
				<tr>
					<th scope="row" class="txt_right br"><label for="mem_sendemail_0">이메일 수신</label></th>
					<td>
						<input type="radio" name="mem_sendemail" id="mem_sendemail_0" value="1" /><label for="mem_sendemail_0"> 수신</label>
						<input type="radio" name="mem_sendemail" id="mem_sendemail_1" value="0" /><label for="mem_sendemail_1"> 미수신</label>
					</td>
				</tr>
				<tr>
					<th scope="row" class="txt_right br"><label for="mem_auth_0">인증</label></th>
					<td>
						<input type="radio" name="mem_auth" id="mem_auth_0" value="1" /><label for="mem_auth_0"> 인증</label>
						<input type="radio" name="mem_auth" id="mem_auth_1" value="0" /><label for="mem_auth_1"> 미인증</label>
					</td>
				</tr>
				<tr>
					<th scope="row" class="txt_right br"><label for="mem_sign">서명</label></th>
					<td>
						<textarea name="mem_sign" id="mem_sign" class="width_90 wysiwyg" placeholder="서명">{result->m_sign}</textarea>
					</td>
				</tr>
				<!-- 
				<tr>
					<th scope="row" class="txt_right br">사진</th>
					<td>
						&nbsp; 사진은 나중에
					</td>
				</tr>
				 -->
			</tbody>
		</table>
		
		<div class="button_area">
			<button type="submit">전송</button>
		</div>
	</form>
</section>